//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "MixedLinearMonotonicCubicNaturalSpline.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolations/MixedLinearCubicInterpolation.h>
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline>& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearMonotonicCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearMonotonicCubicNaturalSpline = &childNative;
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
}
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (QuantLib::MixedLinearMonotonicCubicNaturalSpline& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearMonotonicCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearMonotonicCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline> (&childNative);
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
    _MixedLinearMonotonicCubicNaturalSplineOwner = owner;
    _MixedLinearCubicInterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (CMixedLinearMonotonicCubicNaturalSpline^ copy) : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearMonotonicCubicNaturalSpline = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppMixedLinearMonotonicCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline> (copy->GetShared());
        _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (PLATFORM::Type^ t) : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearMonotonicCubicNaturalSpline = NULL;
#endif
	if (!t->IsSubclassOf(CMixedLinearMonotonicCubicNaturalSpline::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (QuantLib::Handle<QuantLib::MixedLinearMonotonicCubicNaturalSpline>& childNative, Object^ owner)  : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
	_phMixedLinearMonotonicCubicNaturalSpline = &childNative;
	_ppMixedLinearMonotonicCubicNaturalSpline = &static_cast<boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
    _MixedLinearMonotonicCubicNaturalSplineOwner = owner;
}
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (QuantLib::Handle<QuantLib::MixedLinearMonotonicCubicNaturalSpline> childNative)  : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
	_phMixedLinearMonotonicCubicNaturalSpline = &childNative;
	_ppMixedLinearMonotonicCubicNaturalSpline = &static_cast<boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::CMixedLinearMonotonicCubicNaturalSpline (QuantLib::MixedLinearMonotonicCubicNaturalSpline childNative)  : CMixedLinearCubicInterpolation(CMixedLinearMonotonicCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearMonotonicCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearMonotonicCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline> (new QuantLib::MixedLinearMonotonicCubicNaturalSpline (childNative));
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearMonotonicCubicNaturalSpline));
}
#endif

Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::~CMixedLinearMonotonicCubicNaturalSpline ()
{
    if (_ppMixedLinearMonotonicCubicNaturalSpline != NULL)
    {
	    delete _ppMixedLinearMonotonicCubicNaturalSpline;
        _ppMixedLinearMonotonicCubicNaturalSpline = NULL;
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::!CMixedLinearMonotonicCubicNaturalSpline ()
{
    if (_ppMixedLinearMonotonicCubicNaturalSpline != NULL)
    {
	    delete _ppMixedLinearMonotonicCubicNaturalSpline;
    }
}
QuantLib::MixedLinearMonotonicCubicNaturalSpline& Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::GetReference ()
{
    if (_ppMixedLinearMonotonicCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return **_ppMixedLinearMonotonicCubicNaturalSpline;
}
boost::shared_ptr<QuantLib::MixedLinearMonotonicCubicNaturalSpline>& Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::GetShared ()
{
    if (_ppMixedLinearMonotonicCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return *_ppMixedLinearMonotonicCubicNaturalSpline;
}
QuantLib::MixedLinearMonotonicCubicNaturalSpline* Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::GetPointer ()
{
    if (_ppMixedLinearMonotonicCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return &**_ppMixedLinearMonotonicCubicNaturalSpline;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::MixedLinearMonotonicCubicNaturalSpline>& Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::GetHandle ()
{
	if (_phMixedLinearMonotonicCubicNaturalSpline == NULL)
	{
		_phMixedLinearMonotonicCubicNaturalSpline = new Handle<QuantLib::MixedLinearMonotonicCubicNaturalSpline> (*_ppMixedLinearMonotonicCubicNaturalSpline);
	}
	return *_phMixedLinearMonotonicCubicNaturalSpline;
}
#endif
bool Cephei::QL::Math::Interpolations::CMixedLinearMonotonicCubicNaturalSpline::HasNative () 
{
	return (_ppMixedLinearMonotonicCubicNaturalSpline != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

